﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Edit.ascx.cs" Inherits="admin_Modules_News_Edit" %>

<script type="text/javascript">
    var txtMy = "ctl00_contentCtrl_ctl00_txt";
    var Err = "Err";
    var ArrField = new Array("Description", "orderId");

    function ClearAll() {
        var l = ArrField.length;
        for (var i = 0; i < l; i++) {
            var myVal = document.getElementById(txtMy + ArrField[i]);
            myVal.value = "";

        }

        HideAll();
        var myCtrl = document.getElementById(txtMy + ArrField[0]);
        myCtrl.focus();
        return false;
    }

    function HideAll() {
        var l = ArrField.length;
        for (var i = 0; i < l; i++) {
            var myVal = document.getElementById(Err + ArrField[i]);
            myVal.style.display = 'none';
        }
        return false;
    }

    function OnSubmitClick() {
        HideAll();
        var errExisting = false;
        var l = ArrField.length;
        var Errfocus = false;
        for (var i = 0; i < l; i++) {
            var myVal = document.getElementById(txtMy + ArrField[i]);
            if (myVal.value == "") {
                var obj = document.getElementById(Err + ArrField[i]);
                obj.style.display = 'block';
                errExisting = true;
            }
            if (errExisting && !Errfocus) {
                myVal.focus();
                Errfocus = true;
            }
        }

        return !errExisting;
    }

    
</script>

<table cellpadding="0" cellspacing="0" border="0">
    <tr height="25">
        <td>
            <span style="font-family: Helvetica; font-size: 13px; color: Green; font-weight: bold">
                Thêm Category mới</span></td>
    </tr>
    
    <tr>
        <td>
            <div runat="server" id="MyUpdate">
                <table id='tbSearch' width="735" cellpadding="2" cellspacing="0" rules="rows"  border="1"
                    style="border-collapse: collapse">

                     <tr>
                        <td align="left" class="left">
                            Tiêu đề :</td>
                        <td class="center">
                            <asp:TextBox width="300px" id="txtDescription" runat="server" 
                                textmode="SingleLine" CssClass="lsbOpenDay"
                                emptymessage="" skin="Outlook" EnableViewState="true"></asp:TextBox><span>(*)</span>
                        </td >
                         <td class="right" >
                            <div id="ErrDescription" class="Err" style=" display:none;">Bạn chưa nhập tên website</div>
                           
                         </td>
                    </tr>
                    
                    <tr>
                        <td align="left" class="left">
                            Thứ tự :</td>
                        <td class="center">
                            <asp:TextBox width="300px" id="txtorderId" runat="server" 
                                textmode="SingleLine" CssClass="lsbOpenDay" onkeypress="return isNumberKey(event)"
                                emptymessage="" skin="Outlook" EnableViewState="true"></asp:TextBox><span>(*)</span>
                        </td >
                         <td class="right" >
                         <div id="ErrorderId" class="Err" style=" display:none;">Bạn chưa nhập vào đường linkweb</div>
                       
                            </td>
                    </tr>

                       <tr>
                        <td align="left" class="left">
                            Hiển thị menu :</td>
                        <td class="center">
                            <asp:CheckBox ID="chkShowTop" runat="server" />
                        </td >
                         <td class="right" >
                         <div class="Err" style=" display:none;" id="Div1">Xin vui lòng nhập số thứ tự</div>
                            </td>
                    </tr>

             

                    
                        <tr>
                            <td align="center" colspan="3">
                                <asp:Button runat="server" ID="btnAddNew" Text="Thêm mới" Font-Names="Helvetica"
                                    BorderStyle="Solid" BorderWidth="1" onclick="btnAddNew_Click"/>
                                <asp:Button runat="server" ID="btnCancel" Text="Quay lại" Font-Names="Helvetica"
                                    BorderStyle="Solid" BorderWidth="1" onclick="btnCancel_Click1"/>
                            </td>
                        </tr>

                    </table>
            
            </div>
        </td>
    </tr>


</table>


<table width="735" cellpadding="0" cellspacing="0">

    

    <tr>
        <td align="center">
            <div style="padding: 5px 0px 5px 0px" runat="server" id="Div2">
             <%--   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>--%>
                    
                   
<asp:GridView ID="grdDs" runat="server" AutoGenerateColumns="False" DataKeyNames="idCatLang" 
                  ShowFooter="True" 
                    EnableModelValidation="True" onrowcommand="grdDs_RowCommand" 
                    onrowdatabound="grdDs_RowDataBound" 
                    onrowcancelingedit="grdDs_RowCancelingEdit" onrowediting="grdDs_RowEditing" 
                    onrowupdating="grdDs_RowUpdating"> 
<Columns> 

<asp:TemplateField HeaderText="Tiêu đề" Visible="false"> 
<ItemTemplate> 
  <asp:Label ID="lblID" runat="server" Text='<%# Bind("idCatLang") %>'></asp:Label> 
</ItemTemplate> 
</asp:TemplateField> 

<asp:TemplateField HeaderText="Tiêu đề" SortExpression="Name"> 
<EditItemTemplate> 
  <asp:TextBox ID="txtnameCat" runat="server" Text='<%# Eval("nameCat") %>'></asp:TextBox> 
</EditItemTemplate> 
<FooterTemplate> 
  <asp:TextBox ID="NewnameCat" runat="server"></asp:TextBox> </FooterTemplate> 
<ItemTemplate> 
  <asp:Label ID="Label2" runat="server" Text='<%# Bind("nameCat") %>'></asp:Label> 
</ItemTemplate> 
</asp:TemplateField> 

<asp:TemplateField HeaderText="Url"> 
<EditItemTemplate> 
  <asp:TextBox ID="txtUrl" runat="server" Text='<%# Bind("Url") %>'></asp:TextBox> 
</EditItemTemplate> 
<FooterTemplate> 
  <asp:TextBox ID="NewUrl" runat="server" ></asp:TextBox> 
</FooterTemplate> 
<ItemTemplate> 
  <asp:Label ID="Label3" runat="server" Text='<%# Bind("Url") %>'></asp:Label> 
</ItemTemplate> 
</asp:TemplateField> 

<asp:TemplateField HeaderText="Mô tả"> 

<EditItemTemplate> 
  <asp:TextBox ID="txtDescription" runat="server" Text='<%# Eval("Description") %>'></asp:TextBox> 
</EditItemTemplate> 
<FooterTemplate> 
  <asp:TextBox ID="NewDescription" runat="server" ></asp:TextBox> 
</FooterTemplate> 
<ItemTemplate> 
  <asp:Label ID="Label4" runat="server" Text='<%# Bind("Description") %>'></asp:Label> 
</ItemTemplate> 
</asp:TemplateField> 

<asp:TemplateField HeaderText="Ngôn ngữ" Visible="false"> 
<EditItemTemplate> 
  <asp:DropDownList ID="cmbLang" runat="server" DataTextField="nameLang" DataValueField="idLang"> </asp:DropDownList> 
</EditItemTemplate> 
<ItemTemplate> 
  <asp:Label ID="Label5" runat="server" Text='<%# Eval("idLang") %>'></asp:Label> 
</ItemTemplate> 
<FooterTemplate> 
  <asp:DropDownList ID="cmbNewLang" runat="server" DataTextField="nameLang" DataValueField="idLang"> </asp:DropDownList> 
</FooterTemplate> 
</asp:TemplateField> 


<asp:TemplateField HeaderText="Edit" ShowHeader="False"> 
<EditItemTemplate> 
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> 
  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> 
</EditItemTemplate> 
<FooterTemplate> 
  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="AddNew" Text="Add New"></asp:LinkButton> 
</FooterTemplate> 
<ItemTemplate> 
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> 
</ItemTemplate> 
</asp:TemplateField> 

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ControlStyle CssClass="link_label"></ControlStyle>
<ItemTemplate>
                                <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" CommandName="Del"
                                    Text="Delete"></asp:LinkButton>
                            
</ItemTemplate>
</asp:TemplateField>

</Columns> 
</asp:GridView>

           <%--             
                    </ContentTemplate>
                </asp:UpdatePanel>--%>
                
            </div>
        </td>
    </tr>
    
</table>
